﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Common/MasterPages/Dialog.Master"
    AutoEventWireup="true" CodeBehind="ActorSettingForm.aspx.cs" Inherits="DMS.Web.Modules.SystemManagement.Organization.ActorSettingForm" %>

<%@ Register Src="~/Common/Controls/ConfigSettingForSelector.ascx" TagName="ConfigSettingForSelector"
    TagPrefix="uc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PageTitle" runat="server">
    个人参数设置
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="MainHolder" runat="server">
    <fieldset>
        <legend>
            消息提醒设置
        </legend>
        <div style="padding-top: 5px;">
            <uc1:ConfigSettingForSelector ID="cs_SMSAlertSetting" runat="server" ConfigID="IsReceiveSMSAlert"
                ValueTemplate="是:1#否:0" DefaultValue="0" />
            <uc1:ConfigSettingForSelector ID="cs_MailAlertSetting" runat="server" ConfigID="IsReceiveMailAlert"
                ValueTemplate="是:1#否:0" DefaultValue="0" />
            <uc1:ConfigSettingForSelector ID="cs_BeginTimeSetting" runat="server" ConfigID="AlertBeginTimeSetting"
                ValueTemplate="#Day:0,24,60" DefaultValue="09:00" />
            <uc1:ConfigSettingForSelector ID="cs_EndTimeSetting" runat="server" ConfigID="AlertEndTimeSetting"
                ValueTemplate="#Day:0,24,60" DefaultValue="18:00" />
        </div>
    </fieldset>
    <fieldset id="fs_delegate" runat="server">
        <legend>
            <table width="100%" cellpadding="0" cellspacing="0">
                <tr>
                    <td class="title">
                        <span>委托设置</span>
                    </td>
                    <td class="button">
                        <span></span>
                    </td>
                </tr>
            </table>
        </legend>
        <div style="padding-top: 5px;">
            <table cellpadding="1" cellspacing="2" border="0" width="100%">
                <tr>
                    <td width="160px">
                        <asp:Label ID="lblConfigTitle" runat="server">指定代理人</asp:Label>：
                    </td>
                    <td>
                        <asp:TextBox ID="delegateUserName" runat="server" Width="80" OnClick="javascript:SelectUserToApplyMaterials()"></asp:TextBox>
                        <asp:HiddenField ID="hidDelegateUserId" runat="server" />
                        <input id="selectBtn" type="button" value="选择" onclick="SelectUserToApplyMaterials()"/>
                        <input id="clearDelegate" type="button" value="取消委托" onclick="ClearDelegate()"/>
                    </td>
                </tr>
                <tr>
                    <td width="160px">
                        <asp:Label ID="Label1" runat="server">代理时间</asp:Label>：
                    </td>
                    <td>
                        <asp:TextBox ID="tb_startDate" onClick="WdatePicker()" runat="server" Width=70></asp:TextBox>
                                        至
                        <asp:TextBox ID="tb_endDate" onClick="WdatePicker()" runat="server" Width=70></asp:TextBox>
                        <span style="color:Red" id="requredSpan">*必填</span>
                        <span style="color:Red;display:none" id="errorBegin">开始时间不能为空！</span>
                        <span style="color:Red;display:none" id="errorEnd">结束时间不能为空！</span>
                    </td>
                </tr>
            </table>
        </div>
    </fieldset>
    <div style="margin-top:8px;margin-left:3px;"><b style="color:red">温馨提醒</b>：修改以上选项后，请务必点击“提交”按钮以保存设置。</div>
    
<script language="javascript" type="text/javascript" src="/Resources/Scripts/jquery-1.4.1.min.js"></script>
 <script type="text/javascript" >
     jQuery.createXMLDocument = function (string) {
         var browserName = navigator.appName;
         var doc;
         if (browserName == 'Microsoft Internet Explorer') {
             doc = new ActiveXObject('Microsoft.XMLDOM');
             doc.async = 'false'
             doc.loadXML(string);
         } else {
             doc = (new DOMParser()).parseFromString(string, 'text/xml');
         }
         return doc;
     }
    function SelectUserToApplyMaterials() {
        var userID = "";
        var result = SelectMyDeptActorsWithWindowTitle(this, 1, 'userid', encodeURIComponent("请选择代理人"));
        if (result != undefined && result != "") {
            result = $.createXMLDocument(result);
            $(result).find('Actor').each(
                function () {
                    document.getElementById('<%=this.delegateUserName.ClientID%>').value = $(this).attr("Name");
                    document.getElementById('<%=this.hidDelegateUserId.ClientID%>').value = $(this).attr("ID");
                });
            }
            document.getElementById('requredSpan').style.display = "";
        return false;
    }

    function ClearDelegate() {
        document.getElementById('<%=this.delegateUserName.ClientID%>').value = '';
        document.getElementById('<%=this.hidDelegateUserId.ClientID%>').value = '';

        document.getElementById('requredSpan').style.display = "none";
        document.getElementById('errorBegin').style.display = "none";
        document.getElementById('errorEnd').style.display = "none";
    }

    if (document.getElementById('<%=this.delegateUserName.ClientID%>').value == '') {
        document.getElementById('requredSpan').style.display = "none";
        //document.getElementById('errorBegin').style.display = "none";
        //document.getElementById('errorEnd').style.display = "none";
    }

    function check() {
        if (document.getElementById('<%=this.delegateUserName.ClientID%>').value != '') {
            if (document.getElementById('<%=this.tb_startDate.ClientID%>').value == '') {
                document.getElementById('errorBegin').style.display = "";
            }
            if (document.getElementById('<%=this.tb_endDate.ClientID%>').value == '') {
                document.getElementById('errorEnd').style.display = "";
            }
            if (document.getElementById('<%=this.tb_startDate.ClientID%>').value == ''
                || document.getElementById('<%=this.tb_endDate.ClientID%>').value == '') {
                alert('代理时间设置有误，请填写代理时间。');
                return false;
            }
        }
    }
    
 </script>
</asp:Content>

<asp:Content ID="ctFooter"  ContentPlaceHolderID="FooterHolder" runat="server">
<asp:LinkButton ID="btnSave" CssClass="linkbtn" runat="server" OnClientClick="javascript:return check();" OnClick="btnSave_Click"
        CausesValidation="true"><span>保存</span></asp:LinkButton>&nbsp;&nbsp;
<a href="javascript:window.close();" class="linkbtn"><span>关闭</span></a>
</asp:Content>